#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>

using namespace std;

class Person{
public:
    Person(string name)
        :_name(name)
         ,_score(0)
    {

    }

    string _name;
    double _score;
};

void test(){
    vector<Person> players ={Person{"A"},Person{"B"},Person{"C"},Person{"D"},Person{"E"}};


    srand(time(0));
    for (auto& p : players) {
        deque<double> scores;

        // 生成10个分数
        for (int i = 0; i < 10; ++i) {
            double s = 60 + rand() % 41; // 60~100分
            scores.push_back(s);
        }
        sort(scores.begin(),scores.end());
        scores.pop_back();
        scores.pop_front();

          // 计算平均分
        double sum = 0;
        sum = accumulate(scores.begin(),scores.end(),0.0);
        p._score = sum / scores.size();
        cout << "学生姓名："<< p._name << "  " << "平均成绩："<< p._score << endl;
    }
    /* sort(scores.begin(),scores.end()); */
    /* scores.pop_back(); */
    /* scores.pop_front(); */

}

int main()
{
    test();
    return 0;
}

